// createStore 创建store
// applyMiddleware 添加中间件工具
// combineReducers 合并干活的-reducers
import { createStore, applyMiddleware, combineReducers } from 'redux';
// 处理异步action的中间件
import thunk from 'redux-thunk';
// 辅助工具类
import { composeWithDevTools } from 'redux-devtools-extension';

// 项目中的reducers-干活
import { login } from './reducers/login';
import { user } from './reducers/user';
import { home } from './reducers/home';
import { article } from './reducers/article';
// 合并到一个部门统一管理
const rootReducer = combineReducers({ login, user, home, article });

// 和上面是等价的，你也重命名你的reducer
// const rootReducer = combineReducers({ login: login });

const middleWares = composeWithDevTools(applyMiddleware(thunk));
// 创建“公司”-store
export const store = createStore(rootReducer, middleWares);
